home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / wfc007.000 / include / cevntlog.hpp < prev    next >
C/C++ Source or Header  |  1996-04-08  |  3KB  |  95 lines

  1. #if ! defined( EVENT_LOG_CLASS )
  2.  
  3. /*
  4. ** Author: Samuel R. Blackburn
  5. ** CI$: 76300,326
  6. ** Internet: sammy@sed.csc.com
  7. **
  8. ** You can use it any way you like.
  9. */
  10.  
  11. #define EVENT_LOG_CLASS
  12.  
  13. class CEventLog : public CObject
  14. {
  15.    DECLARE_DYNAMIC( CEventLog )
  16.  
  17.    protected:
  18.  
  19.       HANDLE m_LogHandle;
  20.       HANDLE m_EventSourceHandle;
  21.  
  22.       DWORD m_ErrorCode;
  23.       DWORD m_NumberOfBytesRead;
  24.       DWORD m_NumberOfBytesInNextRecord;
  25.  
  26.       void m_Initialize( void );
  27.  
  28.    public:
  29.  
  30.       enum EventType
  31.       {
  32.          eventError       = EVENTLOG_ERROR_TYPE,
  33.          eventWarning     = EVENTLOG_WARNING_TYPE,
  34.          eventInformation = EVENTLOG_INFORMATION_TYPE,
  35.          eventSuccess     = EVENTLOG_AUDIT_SUCCESS,
  36.          eventFailure     = EVENTLOG_AUDIT_FAILURE
  37.       };
  38.  
  39.       CEventLog();
  40.       CEventLog( LPCTSTR source_name );
  41.  
  42.       /*
  43.       ** Destructor should be virtual according to MSJ article in Sept 1992
  44.       ** "Do More with Less Code:..."
  45.       */
  46.  
  47.       virtual ~CEventLog();
  48.  
  49.       /*
  50.       ** Data
  51.       */
  52.  
  53.       CString ComputerName;
  54.       CString LogName;
  55.  
  56.       /*
  57.       ** Methods
  58.       */
  59.  
  60.       virtual BOOL  Backup( LPCTSTR name_of_backup_file );
  61.       virtual BOOL  Clear(  LPCTSTR name_of_backup_file );
  62.       virtual BOOL  Close( void );
  63.       virtual BOOL  CreateApplicationLog( LPCTSTR application_name,
  64.                                           LPCTSTR file_containing_message_table_resource,
  65.                                           DWORD   supported_types );
  66.       virtual BOOL  DeleteApplicationLog( LPCTSTR application_name );
  67.       virtual BOOL  DeregisterSource( void );
  68.       virtual DWORD GetErrorCode( void ) const;
  69.       virtual BOOL  GetNumberOfRecords( DWORD& number_of_records );
  70.       virtual BOOL  NotifyChange( HANDLE event_handle, HANDLE log_handle = NULL );
  71.       virtual BOOL  OpenBackup( LPCTSTR name_of_backup_file, LPCTSTR name_of_computer = NULL );
  72.       virtual BOOL  Open( LPCTSTR log_name, LPCTSTR name_of_computer = NULL );
  73.       virtual BOOL  Read( DWORD  record_number, 
  74.                           LPVOID buffer, 
  75.                           DWORD& number_of_bytes_to_read, 
  76.                           DWORD  how_to_read = EVENTLOG_FORWARDS_READ | EVENTLOG_SEQUENTIAL_READ );
  77.       virtual BOOL  RegisterSource( LPCTSTR source_name, LPCTSTR name_of_computer = NULL );
  78.       virtual BOOL  Report( EventType event_type,
  79.                             WORD      category,
  80.                             DWORD     event_id,
  81.                             WORD      number_of_strings        = 0,
  82.                             LPCTSTR * string_array             = NULL,
  83.                             DWORD     number_of_raw_data_bytes = 0,
  84.                             LPVOID    raw_data_buffer          = NULL,
  85.                             PSID      user_sid                 = NULL );
  86.       virtual BOOL  Report( LPCTSTR   log_name, 
  87.                             DWORD     message_string_resource_id,
  88.                             WORD      number_of_strings = 0,
  89.                             LPCTSTR * string_array      = NULL );
  90.       virtual void  ReportError( LPCTSTR string_to_report );
  91.       virtual void  ReportInformation( LPCTSTR string_to_report );
  92. };
  93.  
  94. #endif // EVENT_LOG_CLASS
  95.